package cscie160.hw5;
import java.rmi.*;
import java.rmi.server.UnicastRemoteObject;
/**
 * This class manages the simplest demo operations with the ATM on server side.
*/
public class Server  extends UnicastRemoteObject{
    private String name;
    
    public Server(String s) throws RemoteException {
        super();
        name = s;
    }
    
    /**
     * main method to collect command line input parameters and launch the server side operations.
     * @param args String[]
    */ 
    public static void main(String args[]){
        //Create and install a security manager
        System.setSecurityManager(new RMISecurityManager());
        try {
            int port = 1099;
            java.rmi.registry.Registry registry = 
                java.rmi.registry.LocateRegistry.createRegistry(port);
            ATMFactoryImpl obj = new ATMFactoryImpl();
            Naming.rebind("//localhost/atmfactory", obj);
            System.out.println("atmfactory bound in registry");
        } catch (Exception e) {
            System.out.println("Server err: " + e.getMessage());
            e.printStackTrace();
        }
    }
}
